package com.hbx.logs;

import lombok.Getter;
import lombok.Setter;

/*
 * @Author:hbx
 * 
 * */
public enum OperaTypeEnum {
    INSERT("添加","insert"),
    UPDATE("更新","update"),
    DELETE("删除","delete"),
    SELECT("查询","select")
    ;

    @Getter
    @Setter
    private String opera;

    @Getter
    @Setter
    private String operaCode;

    OperaTypeEnum(String opera,String operaCode){
        this.opera = opera;
        this.operaCode = operaCode;
    }

    public static String getType(String operaCode){
        OperaTypeEnum[] typeEnums = OperaTypeEnum.values();
        for (OperaTypeEnum typeEnum : typeEnums) {
            if (typeEnum.operaCode.equals(operaCode)){
                return typeEnum.getOpera();
            }
        }
        return null;
    }
}
